//
//  CommunityCollectionViewCell.m
//  FNer
//
//  Created by dllo on 15/11/5.
//  Copyright © 2015年 刘志强. All rights reserved.
//

#import "CommunityCollectionViewCell.h"
#import "Channels.h"
@implementation CommunityCollectionViewCell



-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setCommunityCell];
    }
    return self;
}

-(void)setCommunityCell
{
    self.titleImageView = [[UIImageView alloc] initWithFrame:CGRectMake(5 * XWIDTH, 5 * XHIGHT, 90 * XWIDTH, 90 * XHIGHT)];
    self.titleImageView.backgroundColor = [UIColor colorWithRed:240 / 255.0 green:240 / 255.0 blue:240 / 255.0 alpha:1];
    [self.contentView addSubview:self.titleImageView];
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(120 * XWIDTH, 10 * XHIGHT, 200 * XWIDTH, 30 * XHIGHT)];
    self.titleLabel.textColor = [UIColor grayColor];
    [self.contentView addSubview:self.titleLabel];
    
    self.picImageView = [[UIImageView alloc] initWithFrame:CGRectMake(120 * XWIDTH, 70 * XHIGHT, 15 * XWIDTH, 15 * XHIGHT)];
    self.picImageView.image = [UIImage imageNamed:@"图片_@2x.png"];
    [self.contentView addSubview:self.picImageView];
    
    self.picLabel = [[UILabel alloc] initWithFrame:CGRectMake(140 * XWIDTH, 70 * XHIGHT, 15 * WIDTH, 15 * XHIGHT)];
    self.picLabel.text = @"图片:";
    self.picLabel.textColor = [UIColor lightGrayColor];
    self.picLabel.font = [UIFont systemFontOfSize:13 * XHIGHT];
    [self.picLabel sizeToFit];
    [self.contentView addSubview:self.picLabel];
    
    self.numPic = [[UILabel alloc] initWithFrame:CGRectMake(170 * XWIDTH, 70 * XHIGHT, 60 * XWIDTH, 15 * XHIGHT)];
    //    self.numPic.backgroundColor = [UIColor blackColor];
    self.numPic.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.numPic];
    
    self.dingyuImageView = [[UIImageView alloc] initWithFrame:CGRectMake(240 * XWIDTH, 70 * XHIGHT, 15 * XWIDTH, 15 * XHIGHT)];
    self.dingyuImageView.image = [UIImage imageNamed:@"订阅图标_@2x.png"];
    [self.contentView addSubview:self.dingyuImageView];
    
    self.dingyueLabel = [[UILabel alloc] initWithFrame:CGRectMake(260 * XWIDTH, 70 * XHIGHT, 15 * XWIDTH, 15 * XHIGHT)];
    self.dingyueLabel.text = @"订阅:";
    self.dingyueLabel.textColor = [UIColor lightGrayColor];
    self.dingyueLabel.font = [UIFont systemFontOfSize:13 * XHIGHT];
    [self.dingyueLabel sizeToFit];
    [self.contentView addSubview:self.dingyueLabel];
    
    self.numDing = [[UILabel alloc] initWithFrame:CGRectMake(290 * XWIDTH, 70 * XHIGHT, 60 * XWIDTH, 15 * XHIGHT)];
    self.numDing.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.numDing];
}

-(void)setAchannel:(Channels *)achannel
{
    _achannel = achannel;
    self.titleLabel.text = self.achannel.channelName;
    self.titleLabel.font = [UIFont systemFontOfSize:17 * XHIGHT];
    [self.titleImageView sd_setImageWithURL:[NSURL URLWithString:self.achannel.channelIcon]];
    
    self.numPic.font = [UIFont systemFontOfSize:13 * XHIGHT];
    self.numDing.text = [NSString stringWithFormat:@"%ld",(long)self.achannel.memberCount];
    
    self.numDing.font = [UIFont systemFontOfSize:13 * XHIGHT];
    self.numPic.text = [NSString stringWithFormat:@"%ld",(long)self.achannel.childCount];
    
}








@end
